<!DOCTYPE html>
<html>

  <head>
    <meta charset="UTF-8">
    <title>人员列表</title>
    <link rel="shortcut icon" href="/favicon.ico" type="image/x-icon"/>
    {CSS href="__ADDONSTATIC__css/font.css" /}
    {CSS href="__ADDONSTATIC__css/xadmin.css" /}
    {js href='__ADDONSTATIC__js/jquery-3.2.1.min.js' /}

    {js href='__ADDONSTATIC__js/xadmin.js' /}
    {js href='__ADDONSTATIC__js/util.js' /}
    {js href='__ADDONSTATIC__lib/layui/layui.js' /}
    <!-- 让IE8/9支持媒体查询，从而兼容栅格 -->
    <!--[if lt IE 9]>
      <script src="https://cdn.staticfile.org/html5shiv/r29/html5.min.js"></script>
      <script src="https://cdn.staticfile.org/respond.js/1.4.2/respond.min.js"></script>
    <![endif]-->
  </head>
  
  <body>
    <div class="x-body"  id="page">
      <div class="layui-row">
        <form class="layui-form layui-col-md12 x-so" action="{:addonUrl('Member/pagelist')}?page={$page}">
          <input type="text" name="name" value="{$name}" placeholder="请输入用户名" autocomplete="off" class="layui-input">
          <input type="text" name="phone" value="{$phone}" placeholder="请输入手机号" autocomplete="off" class="layui-input">
          <div class="layui-input-inline">
            <select id="status" name="status">
              <option value="" selected>登记状态</option>
              <option value="1">已登记</option>
              <option value="0">未登记</option>
            </select>
          </div>
          <button type="submit" lay-filter="search" lay-submit="" class="layui-btn" ><i class="layui-icon">&#xe615;</i></button>
          <a class="layui-btn layui-btn-small" style="line-height:1.6em;margin-top:3px;float:right" href="javascript:location.replace(location.href.slice(0,location.href.indexOf('mid')+5));" title="刷新">
            <i class="layui-icon" style="line-height:30px">ဂ</i></a>
        </form>
      </div>
      <xblock>
        <button class="layui-btn" onclick="x_admin_show('添加人员','{:addonUrl('Member/memberAdd')}')"><i class="layui-icon"></i>添加</button>
      </xblock>
      <table class="layui-table">
        <thead>
          <tr>
            <th>序号</th>
            <th>id</th>
            <th>用户名</th>
            <th>所属部门</th>
            <th>手机</th>
            <th>状态</th>
            <th>操作</th>
        </thead>
        <tbody>
        {volist name='list' id='l'}
          <tr>
            <td>{$i+($page-1)*10}</td>
            <td>{$l.id}</td>
            <td>{$l.name}</td>
            <td>{$l.partId|getPPartName}</td>
              <td>{$l.phone}</td>
            <td>{if condition="$l.openId"}
              已登记
              {else/}
              未登记
              {/if}
            </td>
            <td class="td-manage">
              <a title="编辑"  onclick="x_admin_show('编辑','{:addonUrl('Member/memberUpdate')}?id={$l.id}')" href="javascript:;">
                <i class="layui-icon">&#xe642;</i>
              </a>
              <a title="删除" onclick="member_del({$l.id})" href="javascript:;">
                <i class="layui-icon">&#xe640;</i>
              </a>
            </td>
          </tr>
        {/volist}
        </tbody>
      </table>
      <!--分页页面-->
      <?php echo $list->render() ?>
    </div>

    <script>
        /*用户-删除*/
        function member_del(id){
            layer.confirm('确认要删除吗？',function(index){
                //发异步删除数据
                ajaxUrl('{:addonUrl('Member/deleteMember')}',{id:id},function(data){
                    console.log(data);
                    if(data.code == 1){
                        layer.msg('已删除!',{icon:1,time:1000});
                        location.reload();
                    }else{
                        layer.msg(data.message);
                    }
                })
            });
        }
      layui.use(['form','layer'], function() {
          $ = layui.jquery;
          var form = layui.form,layer = layui.layer;

      })
    </script>
  </body>

</html>